\begin{wrapfigure}[0]{r}[0pt]{0cm}
\pgfmathsetmacro{\xrot}{70} 
\pgfmathsetmacro{\zrot}{110}
\tdplotsetmaincoords{\xrot}{\zrot}
\pgfmathsetmacro{\rvec}{.8} 
\pgfmathsetmacro{\zvec}{0.8} 
\pgfmathsetmacro{\phivec}{60}
\pgfmathsetmacro{\thetavec}{atan(\rvec/\zvec)}
\pgfmathsetmacro{\costheta}{cos(\thetavec)}
\pgfmathsetmacro{\sinthetainv}{1/sin(\thetavec)}
\pgfmathsetmacro{\cosphi}{cos(\phivec)}
\pgfmathsetmacro{\sinphi}{sin(\phivec)}
\pgfmathsetmacro{\rsph}{\rvec*\sinthetainv}
\begin{tikzpicture}[scale=0.96,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\def\l{0.6}
\def\d{1.3}


\draw[dashed] (0,0,0) -- (\rvec,0,0) node[anchor=north east]{}; 
\draw[->] (\rvec,0,0) -- (\d,0,0) node[anchor=east]{$x$};
\draw[dashed] (0,0,0) -- (0,\rvec,0) node[anchor= west]{};
\draw[->] (0,\rvec,0) -- (0,\d,0) node[anchor= west]{$y$};
\draw[dashed] (0,0,0) -- (0,0,\zvec) node[anchor=south]{};
\draw[->] (0,0,\zvec) -- (0,0,\d) node[anchor=south]{$z$};


\tdplotdrawarc[]{(O)}{\rvec}{\zrot-180}{\zrot}{anchor=north}{}
\tdplotdrawarc[dashed]{(O)}{\rvec}{\zrot}{\zrot+180}{anchor=north}{}
\tdplotdrawarc[]{(O)}{0.2}{0}{\phivec}{anchor=north}{$\varphi$}


\tdplotsetcoord{P}{\rsph}{\thetavec}{\phivec}
\tdplotsetcoord{L}{\rsph}{\thetavec}{\zrot-180}
\draw (L) -- (Lxy);
\tdplotsetcoord{R}{\rsph}{\thetavec}{\zrot}
\draw (R) -- (Rxy);
\tdplotsetthetaplanecoords{\phivec}
\draw[] (Pz) circle (\rvec);
\tdplotsetrotatedcoords{\phivec}{0}{0}
\draw[color=myblue,-latex] (Pz) -- (P) node[midway,anchor=south]{$\rho$};
\tdplotgetpolarcoords{\cosphi*\rvec}{\sinphi*\rvec}{\costheta*\rvec}
\draw[dashed] (0,0,0) -- (Pxy);
\draw[] (P) -- (Pxy);
\tdplotsetrotatedcoordsorigin{(P)}
\draw[color=myblue,tdplot_rotated_coords,->] (0,0,0) -- (\l,0,0) node[anchor=north west]{$\vec{e}_\rho$};
\draw[color=myblue,tdplot_rotated_coords,->] (0,0,0) -- (0,\l,0) node[anchor=west]{$\vec{e}_\phi$}; \draw[color=myblue,tdplot_rotated_coords,->] (0,0,0)
-- (0,0,\l) node[anchor=south]{$\vec{e}_z$};
\end{tikzpicture}
    \end{wrapfigure}